
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>10.生成电子书 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    
    <link rel="prev" href="9-asciidoc.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" >
            
                <span>
            
                    
                    入门
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="../">
            
                <a href="../">
            
                    
                    0.开始
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.2" data-path="1-install.html">
            
                <a href="1-install.html">
            
                    
                    1.安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.3" data-path="2-init.html">
            
                <a href="2-init.html">
            
                    
                    2.创建一本书
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.4" data-path="3-directory.html">
            
                <a href="3-directory.html">
            
                    
                    3.目录结构
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    基础
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="4-menu.html">
            
                <a href="4-menu.html">
            
                    
                    4.菜单
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="5-set.html">
            
                <a href="5-set.html">
            
                    
                    5.设置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="6-words.html">
            
                <a href="6-words.html">
            
                    
                    6.词汇表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="7-langs.html">
            
                <a href="7-langs.html">
            
                    
                    7.多语言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="8-markdown.html">
            
                <a href="8-markdown.html">
            
                    
                    8.markdown
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="9-asciidoc.html">
            
                <a href="9-asciidoc.html">
            
                    
                    9.AsciiDoc
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.7" data-path="10-E-book.html">
            
                <a href="10-E-book.html">
            
                    
                    10.生成电子书
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    异常处理
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="error.html">
            
                <a href="error.html">
            
                    
                    异常处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="support.html">
            
                <a href="support.html">
            
                    
                    赞助/支持
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >10.生成电子书</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x751F;&#x6210;&#x7535;&#x5B50;&#x4E66;">&#x751F;&#x6210;&#x7535;&#x5B50;&#x4E66;</h1>
<p>gitbook &#x4E0D;&#x4EC5;&#x53EF;&#x4EE5;&#x751F;&#x6210;&#x9759;&#x6001;&#x7F51;&#x7AD9;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x5C06;&#x5185;&#x5BB9;&#x8F93;&#x51FA;&#x4E3A;&#x7535;&#x5B50;&#x4E66;&#xFF08;ePub&#x3001;Mobi&#x3001;PDF&#xFF09;&#x683C;&#x5F0F;&#x3002;  </p>
<pre><code># &#x751F;&#x6210; PDF &#x6587;&#x4EF6;
$ gitbook pdf ./ ./mybook.pdf

# &#x751F;&#x6210; ePub &#x6587;&#x4EF6;
$ gitbook epub ./ ./mybook.epub

# &#x751F;&#x6210; Mobi &#x6587;&#x4EF6;
$ gitbook mobi ./ ./mybook.mobi
</code></pre><h2 id="&#x5B89;&#x88C5;-ebook-convert">&#x5B89;&#x88C5; ebook-convert</h2>
<p><code>ebook-convert</code> &#x662F;&#x751F;&#x6210;&#x7535;&#x5B50;&#x4E66;&#x6240;&#x5FC5;&#x987B;&#x7684;&#xFF08;epub&#xFF0C;mobi&#xFF0C;pdf&#xFF09;&#x63D2;&#x4EF6;&#x3002;  </p>
<h3 id="linux-&#x7CFB;&#x7EDF;">Linux &#x7CFB;&#x7EDF;</h3>
<p>&#x5B89;&#x88C5; <a href="https://calibre-ebook.com/download" target="_blank">Caliber&#x5E94;&#x7528;&#x7A0B;&#x5E8F;</a>&#x3002;  </p>
<pre><code class="lang-sh">$ sudo aptitude install callbre
</code></pre>
<p>&#x5728;&#x67D0;&#x4E9B; Linux &#x53D1;&#x884C;&#x7248;&#x4E2D;&#x5B89;&#x88C5; nodejs , &#x4F60;&#x8FD8;&#x9700;&#x8981;&#x624B;&#x52A8;&#x521B;&#x5EFA;&#x4E00;&#x4E2A; nodejs &#x8F6F;&#x8FDE;&#x63A5;&#xFF1A;  </p>
<pre><code class="lang-sh">$ sudo ln <span class="hljs-_">-s</span> /usr/bin/nodejs /usr/bin/node
</code></pre>
<h3 id="&#x82F9;&#x679C;os-x-&#x7CFB;&#x7EDF;">&#x82F9;&#x679C;OS X &#x7CFB;&#x7EDF;</h3>
<p>&#x4E0B;&#x8F7D;<a href="https://calibre-ebook.com/download" target="_blank">Caliber&#x5E94;&#x7528;&#x7A0B;&#x5E8F;</a>&#x3002;&#x5C06; <code>calibre.app</code> &#x79FB;&#x52A8;&#x5230;&#x4F60;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x6587;&#x4EF6;&#x5939;&#x540E;&#xFF0C;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x6307;&#x5411; ebook-convert &#x5DE5;&#x5177;&#x7684;&#x8F6F;&#x4EF6;&#x8FDE;&#x63A5;&#xFF1A;  </p>
<pre><code class="lang-sh">$ sudo ln <span class="hljs-_">-s</span> /Applications/calibre.app/Contents/MacOS/ebook-convert /usr/bin
</code></pre>
<p>&#x8FD9;&#x6837;&#x5C31;&#x53EF;&#x4EE5;&#x5728;&#x4EFB;&#x4F55;&#x76EE;&#x5F55;&#x4E0B;&#x6267;&#x884C; <code>ebook-convert</code> &#x547D;&#x4EE4;&#x3002;  </p>
<p>&#x5982;&#x679C;&#x51FA;&#x73B0; <code>Operation not permitted</code> &#x5F02;&#x5E38;&#xFF0C;&#x8BF4;&#x660E;&#x7CFB;&#x7EDF;&#x6743;&#x9650;&#x9650;&#x5236;&#xFF0C;&#x9700;&#x8981;&#x914D;&#x7F6E;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x7684;&#x65B9;&#x5F0F;&#x89E3;&#x51B3;&#x3002;  </p>
<pre><code class="lang-sh">$ sudo ln <span class="hljs-_">-s</span> /Applications/calibre.app/Contents/MacOS/ebook-convert /usr/bin/
ln: /usr/bin/ebook-convert: Operation not permitted
</code></pre>
<p>&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x914D;&#x7F6E;  </p>
<p>&#x5148;&#x542F;&#x52A8; ebook-convert &#x5B8C;&#x6210;&#x7B2C;&#x4E00;&#x6B21;&#x542F;&#x52A8;&#x914D;&#x7F6E;&#xFF0C;&#x7136;&#x540E;&#x5173;&#x95ED;&#x3002;&#x63A5;&#x7740;&#x5728;&#x547D;&#x4EE4;&#x884C;&#x6D8C;&#x53E3;&#x4FEE;&#x6539;&#x73AF;&#x5883;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#xFF0C;&#x52A0; <code>EBOOK_PATH</code> (ebook-convert&#x547D;&#x4EE4;&#x7684;&#x6240;&#x5728;&#x76EE;&#x5F55;)  </p>
<pre><code class="lang-sh">vim ~/.bash_profile

<span class="hljs-built_in">export</span> EBOOK_PATH=/Applications/calibre.app/Contents/MacOS
<span class="hljs-built_in">export</span> PATH=<span class="hljs-variable">$PATH</span>:<span class="hljs-variable">$EBOOK_PATH</span>
</code></pre>
<p>&#x7136;&#x540E;&#x5237;&#x65B0;&#x4E00;&#x4E0B;&#x521A;&#x521A;&#x7684;&#x914D;&#x7F6E;  </p>
<pre><code class="lang-sh"><span class="hljs-built_in">source</span> ~/.bash_profile
</code></pre>
<p>&#x6700;&#x540E;&#x6D4B;&#x8BD5;&#x4E00;&#x4E0B; <code>ebook-convert</code> &#x6307;&#x4EE4;&#x662F;&#x5426;&#x80FD;&#x6B63;&#x5E38;&#x88AB;&#x8C03;&#x7528;&#xFF1A;  </p>
<pre><code class="lang-sh">$ ebook-convert --version
ebook-convert(calibre 2.18.0)
Created by: Kovid Goyal &lt;kovi@kovidgoyal.net&gt;
</code></pre>
<p>&#x5927;&#x529F;&#x544A;&#x6210;&#xFF01;<br>&#x4E0B;&#x9762;&#x5C31;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; <code>gitbook pdf ./ ./mybook.pdf</code> &#x547D;&#x4EE4;&#x628A;&#x4F60;&#x7684;&#x9879;&#x76EE;&#x751F;&#x6210; pdf &#x6587;&#x6863;&#x4E86;&#x3002;  </p>
<h2 id="&#x5C01;&#x9762;">&#x5C01;&#x9762;</h2>
<p>&#x6240;&#x6709;&#x683C;&#x5F0F;&#x7535;&#x5B50;&#x4E66;&#x90FD;&#x53EF;&#x4EE5;&#x521B;&#x5EFA;&#x5C01;&#x9762;&#x3002;&#x5728;&#x5B8C;&#x6210;&#x5B89;&#x88C5;&#x53EF;&#x4EE5;&#x81EA;&#x5DF1;&#x63D0;&#x4F9B;&#x4E00;&#x4E2A;&#xFF0C;&#x6216;&#x8005;&#x4F7F;&#x7528;<a href="https://docs.gitbook.com/v2-changes/important-differences" target="_blank">autocover&#x63D2;&#x4EF6;</a>&#x751F;&#x6210;&#x4E00;&#x4E2A;&#x3002;  </p>
<p>&#x8981;&#x521B;&#x5EFA;&#x5C01;&#x9762;&#xFF0C;&#x5728;&#x4F60;&#x7684;&#x4E66;&#x7684;&#x6839;&#x76EE;&#x5F55;&#x4E0B;&#x653E;&#x7F6E;&#x4E00;&#x4E2A; <code>cover.jpg</code> &#x6587;&#x4EF6;&#x3002;&#x8FD8;&#x53EF;&#x4EE5;&#x6DFB;&#x52A0; <code>cover_small.jpg</code> &#x6307;&#x5B9A;&#x4E00;&#x4E2A;&#x8F83;&#x5C0F;&#x7248;&#x672C;&#x7684;&#x5C01;&#x9762;&#x3002;&#x5C01;&#x9762;&#x56FE;&#x7247;&#x683C;&#x5F0F;&#x5FC5;&#x987B;&#x662F;<strong>JPEG</strong>&#x6587;&#x4EF6;&#x3002;  </p>
<p>&#x4E00;&#x4E2A;&#x5408;&#x683C;&#x7684;&#x5C01;&#x9762;&#x5E94;&#x8BE5;&#x9075;&#x5B88;&#x4EE5;&#x4E0B;&#x51C6;&#x5219;&#xFF1A;  </p>
<ul>
<li><code>cover.jpg</code> &#x7684;&#x5927;&#x5C0F;&#x4E3A; 1800x2360 &#x50CF;&#x7D20;&#xFF0C; <code>cover_small.jpg</code> &#x4E3A; 200x262 &#x50CF;&#x7D20;  </li>
<li>&#x65E0;&#x8FB9;&#x6846;  </li>
<li>&#x6E05;&#x6670;&#x53EF;&#x89C1;&#x7684;&#x4E66;&#x540D;  </li>
<li>&#x4EFB;&#x4F55;&#x91CD;&#x8981;&#x7684;&#x6587;&#x672C;&#x5E94;&#x8BE5;&#x5728;&#x5C0F;&#x7248;&#x672C;&#x4E2D;&#x53EF;&#x89C1;  </li>
</ul>
<h2 id="&#x751F;&#x6210;-pdf">&#x751F;&#x6210; PDF</h2>
<p>&#x8FDB;&#x5165;&#x6587;&#x6863;&#x9879;&#x76EE;&#x76EE;&#x5F55;&#xFF0C;&#x8F93;&#x5165; <code>gitbook pdf ./ ./gitbook.pdf</code>  </p>
<pre><code class="lang-sh">$ <span class="hljs-built_in">cd</span> ~/gitbook-cn

$ gitbook pdf ./ ./gitbook.pdf
</code></pre>
<ul>
<li><code>pdf</code> &#xFF1A;&#x8868;&#x793A;&#x751F;&#x6210; pdf &#x683C;&#x5F0F;&#xFF0C;&#x8FD8;&#x6709; epub&#x3001;mobi &#x53EF;&#x9009;  </li>
<li><code>./</code> &#xFF1A;&#x8868;&#x793A;&#x9700;&#x8981;&#x751F;&#x6210;&#x4E66;&#x7C4D;&#x7684;&#x9879;&#x76EE;&#x6839;&#x76EE;&#x5F55;  </li>
<li><code>./gitbook.pdf</code> &#xFF1A;&#x8868;&#x793A;&#x751F;&#x6210;&#x4E66;&#x7C4D;&#x7684;&#x540D;&#x79F0;  </li>
<li>&#x5982;&#x679C;&#x4F60;&#x7684;&#x4E66;&#x7C4D;&#x6709;&#x591A;&#x79CD;&#x8BED;&#x8A00;&#xFF0C;&#x5C31;&#x4F1A;&#x751F;&#x6210;&#x591A;&#x672C;&#x4E66;&#x7C4D;&#xFF0C;&#x4E66;&#x7C4D;&#x7684;&#x540D;&#x79F0;&#x4F1A;&#x4EE5;&#x8BED;&#x8A00;&#x7ED3;&#x5C3E;&#x3002;  </li>
</ul>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="9-asciidoc.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: 9.AsciiDoc">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"10.生成电子书","level":"1.2.7","depth":2,"next":{"title":"异常处理","level":"1.3","depth":1,"ref":"","articles":[{"title":"异常处理","level":"1.3.1","depth":2,"path":"docs/error.md","ref":"./docs/error.md","articles":[]},{"title":"赞助/支持","level":"1.3.2","depth":2,"path":"docs/support.md","ref":"./docs/support.md","articles":[]}]},"previous":{"title":"9.AsciiDoc","level":"1.2.6","depth":2,"path":"docs/9-asciidoc.md","ref":"./docs/9-asciidoc.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"docs/10-E-book.md","mtime":"2020-07-13T05:25:20.231Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-07-13T08:21:17.520Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

